package codetop.microsoft.T240;

/**
 * @Author: 18362
 * @Create: 2022-08-14 9:30:02 星期日
 */
class Solution {
    public boolean searchMatrix(int[][] matrix, int target) {
        int i = 0, j = matrix[0].length-1;
        while (i < matrix.length && j >= 0) {
            if (target == matrix[i][j])
                return true;
            else if (target < matrix[i][j])
                j--;
            else
                i++;
        }
        return false;
    }
}